const path = require('path')

module.exports = {
  outputDir: './build',
  devServer: {
    proxy: {
      '^/api': {
        target: 'http://152.136.185.210:4000',
        pathRewrite: {
          '^/api': ''
        },
        changeOrigin: true
      }
    }
  },
  //写法一 对象
  configureWebpack: {
    resolve: {
      alias: {
        '@': path.resolve(__dirname, 'src'),
        components: '@/components'
      }
    }
  }
  //写法二  函数
  //configureWebpack: (config) => {
  //  config.resolve.alias = {
  //    '@': path.resolve(__dirname, 'src'),
  //    components: '@/components'
  //  }
  //},
  //写法三  链式
  //chainWebpack: (config) => {
  //  config.resolve.alias
  //    .set('@', path.resolve(__dirname, 'src'))
  //    .set('components', '@/components')
  //}
}
